package com.itheima.bigevent.anno;

import com.itheima.bigevent.validation.StateValidation;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.*;

/**
 * ClassName: State
 * Package: com.itheima.bigevent.anno
 * Description:用来校验state
 *
 * @Author: Zhang Peiyuan
 * @Create: 2024-08-20-19:08
 * @Version: v1.0
 */

@Documented
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = {StateValidation.class}) // 用来指定提供校验规则的类
public @interface State {
    // 提供校验失败的信息
    String message() default "{state字段只能使用草稿或者已发布}";

    Class<?>[] groups() default { };

    // 负载, 获取到State注解的附加信息
    Class<? extends Payload>[] payload() default { };
}
